import java.util.Arrays;

public class Six {
	public static void main(String[] args) {
		// 7、int[] arr11 = {1, 2, 3, 4,5,6,7,8,9,0,3,2,4,5,6,7,4,32,2,1,1,4,6,3}; 数组去重
		/*
		 * int[] arr11 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 2, 4, 5, 6, 7, 4, 32, 2, 1,
		 * 1, 4, 6, 3 }; Arrays.sort(arr11); System.out.println(Arrays.toString(arr11));
		 * int newLength = arr11.length;// 新数组的长度 for (int i = 0; i < arr11.length; i++)
		 * { if (arr11[i] == arr11[++i]) { newLength--; } i--; }
		 * System.out.println(newLength);
		 */
		int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 2, 4, 5, 6, 7, 4, 32, 2, 1, 1, 4, 6, 3 };
		int count = 0, num = -1;
		for (int i = 0; i < arr.length - 1; i++) {
			for (int j = i + 1; j < arr.length; j++) {
				if (arr[i] == arr[j]) {// 当有相同的值时，把这个值赋为num，而后num--，保证下次赋值时，值是不一样的
					arr[j] = num;
					num--;
					count++;// 计数是用来计算到底有几个值重复了
				}
			}
		}
		int[] newArr = new int[arr.length - count];
		int j = 0;
		for (int i = 0; i < arr.length; i++) {

			if (arr[i] >= 0) {// 把那些大于0的值都赋给新数组
				newArr[j] = arr[i];
				j++;
			}
		}

		System.out.println(Arrays.toString(newArr));
	}
}
